import { mapGetters } from 'vuex'

export default {
	computed:{
		...mapGetters('m_cart', ['total'])
	},
	
	onShow() {
		//设置主页面右上角的徽标
		if(this.total != 0){
			this.setBadge()
		}
		
	},
	watch:{
		total(){
			this.setBadge()
		}
	},
	methods: {
		setBadge() {		
			uni.setTabBarBadge({
				index: 2,
				text: this.total + ''
			})

		}
	}
}